﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Pageparkproject.Controllers
{
    public class NewsController : Controller
    {
        Models.Stories St = new Models.Stories();
        //
        // GET: /News/
        Models.tblSetting setting = Models.Stories.GetPageSetting();
        public ActionResult Index(int? id)
        {
            int cateID = (id ?? 0);
            return View(St.newsList(cateID).OrderByDescending(m => m.dDatepost).ToList());
        }
        public ActionResult NewsList(string time)
        {
            int? t = null;
            if (!time.Equals("all")) t = int.Parse(time);
            return PartialView(St.newsListFilter(t).OrderByDescending(m => m.dDatepost).ToList());
        }
        public ActionResult NewsDetail(int id)
        {
            return View(St.newsGetByID(id));
        }
    }
}
